﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain.DAL;

namespace Domain.DAL
{
    public class OrderDAL
    {


        internal static int addNewOrder(BLL.OrderBLL orderBLL)
        {
            using (var cs = new CSEntities())
            {
                var _order = new Order();
                _order.CustomerID = orderBLL.CustomerID;
                _order.RequiredDate = orderBLL.RequiredDate;
                _order.ShipAddress = orderBLL.ShipAddress;

                cs.AddToOrders(_order);
                cs.SaveChanges();
                orderBLL.OrderID = _order.OrderID;
                return _order.OrderID;
            }

        }
    }
}
